package jxta.chat.module;

import java.util.ArrayList;
import java.util.List;

import net.jxta.peergroup.PeerGroup;
import net.jxta.protocol.PipeAdvertisement;

/**
 * An abstract class for all the module manager classes.
 * the class manages all the network events of a certain module.
 */
public abstract class AbstractModuleManager {

	protected String moduleName;
	protected String moduleType;
	
	public AbstractModuleManager(String name, String type){
		this.moduleName = name;
		this.moduleType = type;
	}
	
	protected List<ModulePipeListener> listeners = null;
	
	
	/**
	 * Adds a new listener to the module
	 * @param listener
	 */
	public void addListener(ModulePipeListener listener){
		if (listeners == null){
			listeners = new ArrayList<ModulePipeListener>();
		}
		
		listeners.add(listener);
	}
	
	/**
	 * Initialize the module manager class
	 * @return TODO
	 */
	public abstract PipeAdvertisement initialize(PeerGroup pg);
	
	
}
